<%@ page import = "clothing.database.Customer" %>
<%@ page import = "java.util.ArrayList" %>
<%@page import = "clothing.database.CustomerManager" %>
<%@ include file = "templates/header.jsp" %>


<%
String id =request.getParameter("id2");
System.out.println(id);

int iid = Integer.parseInt(id);
CustomerManager cm = new CustomerManager();
Customer editCustomer = cm.getCustomer(iid);
String firstname = editCustomer.getFirstName();
String lastname = editCustomer.getLastName();
String street = editCustomer.getStreet();
String city = editCustomer.getCity();
String state = editCustomer.getState();
int zip = editCustomer.getZip();
String email = editCustomer.getEmail();
System.out.println(firstname);
%>



<h3> Edit Customer Page </h3>

<script>
function process(a)
{
		document.getElementById('id').value=a;
		document.myform.submit();
}  
</script>
   
	
<h2> Edit a Customer </h2>
<form name="myform" id="myform" action ="updateCustomer.jsp" method = "post" >
	<table>
		<tr>
            <td>Customer ID</td>
            <% out.println("<td name=\"uid\" value=\""+iid+"\">"+iid+"</td>"); %>
            
            
        </tr>
        <tr>
			<td>First Name: </td>           
            <% out.println("<td><input name=\"firstname\" value=\""+firstname+"\"></td>"); %>
                 
		</tr>
        
        <tr>
			<td>Last Name: </td>           
            <% out.println("<td><input name=\"lastname\" value=\""+lastname+"\"></td>"); %>
                 
		</tr>
        <tr>
			<td>Street: </td>           
            <% out.println("<td><input name=\"street\" value=\""+street+"\"></td>"); %>
                 
		</tr>
        <tr>
			<td>City: </td>           
            <% out.println("<td><input name=\"city\" value=\""+city+"\"></td>"); %>
                 
		</tr>
        <tr>
			<td>State: </td>           
            <% out.println("<td><input name=\"state\" value=\""+state+"\"></td>"); %>
                 
		</tr>
        <tr>
			<td>Zip: </td>           
            <% out.println("<td><input name=\"zip\" value=\""+zip+"\"></td>"); %>
                 
		</tr>
		<tr>
			<td>Email: </td>           
            <% out.println("<td><input name=\"email\" value=\""+email+"\"></td>"); %>
                 
		</tr>
       
       
      <tr>
			<td> </td><td><input type="submit" value= "submit" onclick = "process(<%= id %>);" /></td>
		</tr>
    <input type="hidden" name ="id" id = "id" />
	</table>
	</form>

<%@ include file = "templates/footer.jsp" %>
